package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.ClassBean;
import com.project.dao.ClassDao;
import com.project.service.ClassService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 小班
 */
@Service
@Transactional
public class ClassServiceImpl extends ServiceImpl<ClassDao, ClassBean> implements ClassService {
    @Override
    public IPage<ClassBean> findAllClass(int pageNO, int pageSize) {
        Page<ClassBean> page = new Page<>(pageNO,pageSize);
        IPage<ClassBean> iPage = this.page(page);
        this.baseMapper.findAllClass();
        return iPage;
    }

    @Override
    public void addClass(ClassBean classBean) {
        this.baseMapper.addClass(classBean);
    }

    @Override
    public ClassBean findId(int classId) {
        return this.baseMapper.findId(classId);
    }

    @Override
    public void updateClass(int classId, String classPerson, String classPersonTel) {
        ClassBean classBean = new ClassBean();
        classBean.setClassId(classId);
        classBean.setClassPerson(classPerson);
        classBean.setClassPersonTel(classPersonTel);
        this.updateById(classBean);

    }

    @Override
    public List<ClassBean> findName(String className, String regionId) {
        return this.baseMapper.findName(className,regionId);
    }
}
